package com.financing.wap.dao.impl;


import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.financing.wap.dto.DstUserArticleCategoriesDTO;
import com.financing.wap.dao.IDstUserArticleCategoriesDao;
import com.financing.wap.vo.UserArticleInfoCategoriesVO;
import com.financing.wap.common.SqlName;
/**
 * dst_user_article_categories  
 * 用户关联分类和喜爱分类 数据访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("dstUserArticleCategoriesDao")
public class DstUserArticleCategoriesDaoImpl extends BaseDaoImpl<DstUserArticleCategoriesDTO, java.lang.Integer> implements IDstUserArticleCategoriesDao {


	@Override
	public int insert(DstUserArticleCategoriesDTO dstUserArticleCategories) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.insert(SqlName.DstUserArticleCategoriesSql.insert, dstUserArticleCategories);
	}

	@Override
	public void update(DstUserArticleCategoriesDTO dstUserArticleCategories) throws SQLException {
		this.sqlMapClientTemplate.update(SqlName.DstUserArticleCategoriesSql.update, dstUserArticleCategories);
	}

	@Override
	public void updateForce(DstUserArticleCategoriesDTO dstUserArticleCategories) throws SQLException {
		this.sqlMapClientTemplate.update(SqlName.DstUserArticleCategoriesSql.updateForce, dstUserArticleCategories);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		this.sqlMapClientTemplate.delete(SqlName.DstUserArticleCategoriesSql.delete,id);
	}
	
	@SuppressWarnings("unchecked")	
	@Override
	public List<DstUserArticleCategoriesDTO> queryList(DstUserArticleCategoriesDTO dstUserArticleCategories) throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.DstUserArticleCategoriesSql.queryList, dstUserArticleCategories);
	}

	@Override
	public int queryListCount(DstUserArticleCategoriesDTO dstUserArticleCategories) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.DstUserArticleCategoriesSql.queryListCount, dstUserArticleCategories);
	}

	@Override
	public DstUserArticleCategoriesDTO loadById(Integer id) throws SQLException {
		return  (DstUserArticleCategoriesDTO)this.getSqlMapClientTemplate().queryForObject(SqlName.DstUserArticleCategoriesSql.loadById,id);
	}

	@Override
	public Class<DstUserArticleCategoriesDTO> getEntityClass() {
		return DstUserArticleCategoriesDTO.class;
	}
 	
	@Override
	public List<UserArticleInfoCategoriesVO> queryAllCategoriesByOpenId(
			String openid) throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.DstUserArticleCategoriesSql.queryAllCategoriesByOpenId, openid);
	}
}
